package com.lgqz.himalayafm.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

import com.lgqz.himalayafm.R;

public class ImgWebView extends AppCompatActivity {
    private WebView webView;
    private TextView text;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.img_webview);


        webView = (WebView) findViewById(R.id.web_view);
        text= (TextView) findViewById(R.id.web_tv);

        init();



    }

    private void init() {
        Intent intent=this.getIntent();
        String url=intent.getStringExtra("url");



        webView.setWebViewClient(new WebViewClient());
        webView.setWebChromeClient(new WebChromeClient(){
            @Override
            public void onReceivedTitle(WebView view, String title) {
                super.onReceivedTitle(view, title);
                if (!TextUtils.isEmpty(title)){
                    text.setText(title);
                }
            }
        });

        webView.loadUrl(url);



    }

    public void back(View view){
        finish();
    }
    public void close(View view){
        finish();
    }





}
